/*
 *  Copyright 2004 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.blandware.atleap.persistence.core;

import com.blandware.atleap.common.util.PartialCollection;
import com.blandware.atleap.common.util.QueryInfo;
import com.blandware.atleap.model.core.MailTemplate;

import java.util.Map;

/**
 * <p>DAO for mail message template</p>
 * <p><a href="MailMailMessageTemplateDAO.java.html"><i>View Source</i></a></p>
 *
 * @author Sergey Zubtsovskiy <a href="mailto:sergey.zubtsovskiy@blandware.com">&lt;sergey.zubtsovskiy@blandware.com&gt;</a>
 * @version $Revision: 1.4 $ $Date: 2006/08/03 10:07:37 $
 */
public interface MailTemplateDAO extends LocalizableDAO {

	// ~ CRUD methods ================================================================

	/**
	 * Creates new template. Template is created without links to pages or resources.
	 *
	 * @param template Value object that represents what template must be created
	 * @return ID of created template
	 */
	public Long createMailTemplate(MailTemplate template);

	/**
	 * Retrieves template with specified ID
	 *
	 * @param templateId ID to search by
	 * @return Template with specified id or null if no such template could be found
	 */
	public MailTemplate retrieveMailTemplate(Long templateId);

	/**
	 * Updates template
	 *
	 * @param template      Template to update
	 * @param linkedObjects Map of pairs <code>uri -&gt; object<code>, which link URI in the body to
	 *                      corresponding object (resource or page) if it exists
	 */
	public void updateMailTemplate(MailTemplate template, Map linkedObjects);

	/**
	 * Deletes template
	 *
	 * @param template Template to delete
	 */
	public void deleteMailTemplate(MailTemplate template);

	// ~ Additional methods ================================================================

	/**
	 * Retrieves filtered/sorted collection of templates.
	 *
	 * @param queryInfo Object that contains information about how to filter and sort data
	 * @return Collection of templates
	 */
	public PartialCollection listMailTemplates(QueryInfo queryInfo);

	// ~ Finders ================================================================

	/**
	 * Finds template by its identifier
	 *
	 * @param identifier Identifier of template to search by
	 * @return Template or null if nothing was found
	 */
	public MailTemplate findMailTemplateByIdentifier(String identifier);

}
